from django.db import models
from django.utils import timezone

from apps.patients.models import Patient


class Attendant(models.Model):
    name = models.CharField(max_length=30, verbose_name='姓名')
    IDCard = models.CharField(max_length=30, verbose_name='身份证号')
    birth = models.DateField(verbose_name='出生日期')
    gender = models.CharField(max_length=1, verbose_name='性别', default='男', null=True)
    phone = models.CharField(max_length=30, verbose_name='电话号', blank=True)
    start_time = models.DateTimeField(verbose_name='陪护开始时间', default=timezone.now)
    end_time = models.DateTimeField(verbose_name='陪护结束时间', default=None, null=True, blank=True)
    risk_level = models.CharField(max_length=3, verbose_name='地区风险等级', default='低风险')
    trip = models.CharField(max_length=30, verbose_name='行程信息', default=None)
    survey = models.CharField(max_length=30, verbose_name='流调信息', default=None)
    temperature = models.CharField(max_length=10, verbose_name='入院体温', default='', blank=True)
    nuclein = models.CharField(max_length=2, verbose_name='核酸报告', default='阴性')
    face_img = models.ImageField(verbose_name='人脸照片', upload_to=None, height_field=None, width_field=None, )
    state = models.CharField(max_length=30, verbose_name='陪护状态', default=None, null=True)
    patient = models.ForeignKey(Patient, verbose_name='所属病人', db_constraint=False, on_delete=models.DO_NOTHING)

    class Meta:
        verbose_name = "陪护人员"
        verbose_name_plural = verbose_name
        db_table = "attendant"
